package com.xiaotu.threadMethod;

/**
 * @Author xiaotu
 * @Description //TODO
 * @Date 2022/3/25 17:09
 * @ClassName TestDaemon
 * @Version 1.0
 * 测试线程守护
 **/
public class TestDaemon {
    public static void main(String[] args) {
        System.out.println(Integer.MAX_VALUE);
        System.out.println(Integer.MIN_VALUE);
        System.out.println(Long.MAX_VALUE);
        System.out.println(Long.MIN_VALUE);

        God god = new God();
        Thread t_god = new Thread(god);
        t_god.setDaemon(true);
        t_god.start();
        You you = new You();
        new Thread(you).start();

    }
}
class God implements Runnable{
    @Override
    public void run() {
        while (true){
            System.out.println("上帝守护着你");
        }
    }
}
class You implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i <= 36500; i++) {
            if(i>=36500){
                System.out.println("GoodBye World!");
                break;
            }
            System.out.println("你活的很开心");

        }
    }
}

